package com.yulang.security.pojo;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * <p>
 * 系统 - 日志表
 * </p>
 *
 * @author Administrator
 * @since 2020-08-02
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("cloud_history")
public class CloudHistory implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = ID, type = IdType.AUTO)
    private Long id;

    /**
     * 业务名称
     */
    @TableField(SERVICE_NAME)
    private String serviceName;

    /**
     * 业务地址
     */
    @TableField(SERVICE_URL)
    private String serviceUrl;

    /**
     * IP
     */
    @TableField(REQUEST_IP)
    private String requestIp;

    /**
     * 用户id，0:未登录用户操作
     */
    @TableField(USER_ID)
    private Long userId;

    /**
     * 运行状态
     */
    @TableField(RUN_STATUS)
    private Integer runStatus;

    /**
     * 后台运行时间
     */
    @TableField(CONSUMING_TIME)
    private String consumingTime;

    /**
     * 创建时间
     */
    @TableField(CREATE_TIME)
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField(UPDATE_TIME)
    private Date updateTime;

    /**
     * app,pc
     */
    @TableField(SERVICE_TYPE)
    private String serviceType;

    /**
     * post,get
     */
    @TableField(HTTP_METHOD)
    private String httpMethod;

    /**
     * 浏览器
     */
    @TableField(UA)
    private String ua;


    public static final String ID = "`id`";

    public static final String SERVICE_NAME = "`service_name`";

    public static final String SERVICE_URL = "`service_url`";

    public static final String REQUEST_IP = "`request_ip`";

    public static final String USER_ID = "`user_id`";

    public static final String RUN_STATUS = "`run_status`";

    public static final String CONSUMING_TIME = "`consuming_time`";

    public static final String CREATE_TIME = "`create_time`";

    public static final String UPDATE_TIME = "`update_time`";

    public static final String SERVICE_TYPE = "`service_type`";

    public static final String HTTP_METHOD = "`http_method`";

    public static final String UA = "`ua`";


    public static final String ID_COMMENT = "id";

    public static final String SERVICE_NAME_COMMENT = "业务名称";

    public static final String SERVICE_URL_COMMENT = "业务地址";

    public static final String REQUEST_IP_COMMENT = "IP";

    public static final String USER_ID_COMMENT = "用户id，0:未登录用户操作";

    public static final String RUN_STATUS_COMMENT = "运行状态";

    public static final String CONSUMING_TIME_COMMENT = "后台运行时间";

    public static final String CREATE_TIME_COMMENT = "创建时间";

    public static final String UPDATE_TIME_COMMENT = "更新时间";

    public static final String SERVICE_TYPE_COMMENT = "app,pc";

    public static final String HTTP_METHOD_COMMENT = "post,get";

    public static final String UA_COMMENT = "浏览器";



    public static CloudHistory of(Object obj) {
        CloudHistory e = new CloudHistory();
        BeanUtils.copyProperties(obj, e);
        return e;
    }

    public static QueryWrapper<CloudHistory> queryWrapper(Object obj) {
        return new QueryWrapper<>(of(obj));
    }

}
